<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt"%>
<%@taglib uri="/billing" prefix="b"%>
<%@page import="com.admin.service.ProvinceService"%>
<%
response.setHeader("Cache-Control","no-cache"); //HTTP 1.1

//or response.setHeader("Cache-Control","no-store");//HTTP 1.1

response.setHeader("Pragma","no-cache"); //HTTP 1.0

response.setDateHeader ("Expires", 0); //prevents caching at the proxy server
%>

<%@page import="com.admin.bean.ProvinceBean"%>
<%@page import="com.admin.util.PageBean"%>
<%@page import="com.admin.bean.AdminSpBean"%><html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>计费后台管理</title>
<link rel="stylesheet" type="text/css" href="<%=request.getContextPath() %>/css/managercss.css">
<link rel="stylesheet" type="text/css" href="<%=request.getContextPath() %>/css/wbox.css">
<script type="text/javascript" src="<%=request.getContextPath() %>/js/jquery-1.4.min.js"></script>
<script type="text/javascript" src="<%=request.getContextPath() %>/js/jquery.form.js"></script>
<script type="text/javascript" src="<%=request.getContextPath() %>/js/wbox.js"></script>
<script type="text/javascript" src="<%=request.getContextPath() %>/js/validate.js"></script>
<script type="text/javascript">
<!--
	$(function(){
		$(".list div").mousemove(function(){
			$(this).css("background","#E3EEFF");
		}).mouseout(function(){
			$(this).css("background","");
		});
		$("#provinceId").val('${provinceId}');
		$("#isp").val('${isp}');
		$("#vodCustomized").val('${vodCustomized}');
	});

	function del(spId){
		if(confirm("你确认删除该SP吗?")){
			$.ajax({
				url:"<%=request.getContextPath() %>/admin/sp/del/"+spId,
				type:"GET",
				success:function(flag){
					if(flag=='1'){
						alert("删除成功!");
						window.location.reload();
					}else{
						alert("删除失败!");
					}
				}
			});
		}
	}
	function addSp(){
		var wBox = $("#ajax").wBox({
			requestType: "iframe",
			iframeWH:{width:700,height:600},
			target:"<%=request.getContextPath() %>/admin/sp/toadd",
			title: "添加新的SP"
		});
		wBox.showBox();
	}

	function back(){
		location.href="<%=request.getContextPath() %>/admin/company";
	}
	
	function fenpei(spid){
		var wBox = $("#ajax").wBox({
			requestType: "iframe",
			iframeWH:{width:700,height:600},
			target:"<%=request.getContextPath() %>/admin/sp/tofenpei/"+spid,
			title: "分配SP通道"
		});
		wBox.showBox();
	}

	function show(spId){
		var wBox = $("#ajax").wBox({
			requestType: "iframe",
			iframeWH:{width:700,height:600},
			target:"<%=request.getContextPath() %>/admin/sp/"+spId,
			title: "查看SP"
		});
		wBox.showBox();
	}
//-->
</script>
<style type="text/css">

</style>
</head>
<body>
<div class="information">
	<div class="title">
		SP列表
	</div>
	<div class="listTitle">
		<table>
			
			<tr>
			<td width="60">通道列表</td>
			<td width="60">业务名称</td>
			<td width="60">业务线</td>
			<td width="60">运营商</td>
				<%
			for(int i = 0;i<=30;i++) {
				ProvinceBean bean = ProvinceService.getProvinceList().get(i);
			%>
			<td width="30px"><%=bean.getProvince() %></td>
			<%} %>
			</tr>
			
				<%
				
				PageBean<AdminSpBean> pageBean = (PageBean)request.getAttribute("pageBean");
				for(AdminSpBean spBean:pageBean.getResult()) {%>
				<tr>
			<td><a href="#"  onclick="show(<%=spBean.getId() %>)"><%=spBean.getCompanyname() %></a></td>
			<td><%=spBean.getSpcodename() %></td>
			<td><%=spBean.getBussiness() %></td>
			<td><%if(spBean.getSpisp()==1){%>移动<%} else if(spBean.getSpisp()==2) {%>联通<%} %></td>
				<%
				
				for(int i = 0;i<=30;i++) {
					ProvinceBean bean = ProvinceService.getProvinceList().get(i);
				if(spBean.getProvince().contains(bean.getProvince())) {
			%>
			<td width="30px"><font color="red">√</font></td>
			<%
				} else {
			%><td width="30px">×</td><%
				}
				}%>
				</tr>
				<%} %>
			
		</table>
	</div>
	<div class="list">
		
	</div>
	<jsp:include page="../page.jsp" flush="true"></jsp:include>
	
</div>
</body>
</html>